<?php

namespace App\Http\Requests;

use Illuminate\Foundation\Http\FormRequest;

class DrugSearchRequest extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     * @return array
     */
    public function rules()
    {
        return [
            'size'  => 'nullable|integer|min:10',
            'group' => 'nullable|integer|min:1',
        ];
    }

    public function messages()
    {
        return [
            'size.integer'          => '每页数量 必须是整数。',
            'size.min'              => '每页数量 最少10条。',
            'group.integer'         => '分组ID 必须是整数。',
            'group.min'             => '分组ID 最小是1。',
        ];
    }
}
